package test00.tx09;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Stream;

public class MainTest {
    public static void main(String[] args) {
        Method[] methods = UserService.class.getDeclaredMethods();
//        List<Method> methodList = Arrays.stream(methods)
//                .filter(m -> m.isAnnotationPresent(Order.class))
//                .sorted(Comparator.comparingInt(m->m.getAnnotation(Order.class).value()))
//                .toList();
//        methodList.forEach(System.out::println);

        Stream<Method> methodList = Arrays.stream(methods);
                methodList.filter(m -> m.isAnnotationPresent(Order.class))
                .sorted(Comparator.comparingInt(m->m.getAnnotation(Order.class).value()))
                .map(Method::getName)
                .forEach(System.out::println);
    }
}
